package com.ma.chapter4.t1;

import lombok.extern.slf4j.Slf4j;

/**
 * @ClassName Test2
 * @Author: mayongqiang
 * @DATE 2022/3/3 22:22
 * @Description:
 */
@Slf4j(topic = "m.test")
public class Test2 {
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread("t1") {
            @Override
            public void run() {
                log.debug("enter running");
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    log.debug("wake up");
                    e.printStackTrace();
                }
            }
        };
        t1.start();
        Thread.sleep(2000);
        log.debug("interrupt");
        t1.interrupt();
    }
}
